﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ZWZ.Web.WebAdmin
{
    public partial class Cat : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                CtrList1.Columns = new List<UCtrs.ListColumn>() { 
                     new UCtrs.ListColumn(){ Caption="名称", FieldName="Text", Style="text-align:left;", ShowToolTip=false},
                     new UCtrs.ListColumn(){Caption="&nbsp;", FieldName="Type", Width="80px"},
                     new UCtrs.ListColumn(){Caption="&nbsp;", FieldName="PageFile", Width="100px"},
                     new UCtrs.ListColumn(){ Caption="排序", FieldName="Index", Width="30px" },
                };
                BindData();
            }
        }
        protected void BindData()
        {
            var menu = Codes.Comm.Menu.GetSortMenu();
            menu.ForEach(i =>
            {
                i.Text = i.Text.Replace("│", "<img alt='│' align='middle' src='/WebAdmin/images/i.gif'/>  ");
                i.Text = i.Text.Replace("├", "<img alt='├' align='middle' src='/WebAdmin/images/t.gif'/>  ");
            });
            CtrList1.DataSource = menu;
            CtrList1.DataBind();
        }
    }
}